<template>
  <div>
    <h2>我是About的内容</h2>
  </div>
</template>

<script>
  export default {
    name: "About",
    /* beforeDestroy() {
      console.log('About组件即将被销毁了')
    }, */
    mounted() {
      // console.log('About组件挂载完毕了', this.$route)
    },

    // 通过路由规则，进入该组件时被调用
    // 直接写组件标签是不会触发的
    beforeRouteEnter(to, from, next) {
      console.log('App-beforeRouteEnter', to, from);
      if(localStorage.getItem("school") === "aiguigu") {  // 权限控制的具体规则
        document.title = to.meta.title || "硅谷系统"
        next()  // 放行
      } else {
        alert("学校名不对，无权限查看")
      }
    },

    // 通过路由规则，离开该组件时被调用
    beforeRouteLeave(to, from, next) {
      console.log('App-beforeRouteLeave', to, from);
      next()
    },
  };
</script>
